/*
 * @Author: your name
 * @Date: 2021-11-22 16:02:33
 * @LastEditTime: 2022-01-15 14:53:00
 * @LastEditors: your name
 * @Description: 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 * @FilePath: \agricultural-production-web\src\api\basic-info-manage\category-management\index.js
 */
/*
 * @Description: 种养类别管理
 */
import zhreq from "@/api/axios";
export default {
  /**
   * @description: 获取所有种养类别表格列表 *代表必填
   * @param {String/Number} page *
   * @param {String/Number} size *
   */
  getplantingTypeList(params) {
    return zhreq.post("/v3/templateTenant/plantType/queryPageByCondition", {
      ...params,
      auditFlag: 1,
      entity: {
        farmingTypeNo: sessionStorage.farmingTypeNo,
        organizationNo: sessionStorage.organizationNo
      }
    });
  },
  getallTypelist(params) {
    return zhreq.post("/v3/category/plantType/queryPageByCondition", {
      ...params,
      auditFlag: 1,
      entity: {
        farmingTypeNo: sessionStorage.farmingTypeNo
      }
    });
  },
  /**
   * @description: 获取所有种养类比树状列表 *代表必填
   */
  getplantingTypeTree() {
    // return zhreq.get(`/plantingType/queryTreeList/${sessionStorage.farmingTypeNo}`);
    return zhreq.get(
      `/v3/templateTenant/plantType/queryTree?organizationNo=${sessionStorage.organizationNo}&farmingTypeNo=${sessionStorage.farmingTypeNo}`
      // `/plantingType/queryTreeList/${sessionStorage.farmingTypeNo}`
    );
  },
  getplantingTypeTreeTwo(farmingTypeNo) {
    // return zhreq.get(`/plantingType/queryTreeList/${sessionStorage.farmingTypeNo}`);
    return zhreq.get(
      `/v3/templateTenant/plantType/queryTree?organizationNo=${sessionStorage.organizationNo}&farmingTypeNo=${farmingTypeNo}`
      // `/plantingType/queryTreeList/${sessionStorage.farmingTypeNo}`
    );
  },
  getcategoryTreeTwo(farmingTypeNo) {
    // return zhreq.get(`/plantingType/queryTreeList/${sessionStorage.farmingTypeNo}`);
    return zhreq.get(
      `/v3/category/plantType/queryTree?organizationNo=${sessionStorage.organizationNo}&farmingTypeNo=${farmingTypeNo}`
      // `/plantingType/queryTreeList/${sessionStorage.farmingTypeNo}`
    );
  },
  getAllPlantingTypeTree() {
    return zhreq.get(
      `/v3/category/plantType/queryTree?farming=PLANT`
    );
  },
  /**
   * @description: 添加种养类别
   * @param {Object}  *
   * @auditFlag 审核标志(0未审核 1已审核)
   * @farmingTypeNo 农业类型
   * @parentId 父id
   * @plantingTypeName 类别名称
   */
  addList(list) {
    return zhreq.post("/v3/templateTenant/plantType/importPublicList", {
      list: list,
      organizationNo: sessionStorage.organizationNo,
      farmingTypeNo: sessionStorage.farmingTypeNo
    });
  },
  /**
   * @description: 批量删除种养类别
   * @param {Object}  *
   */
  delList(list) {
    return zhreq.post("/v3/templateTenant/plantType/delListByNo", {
      organizationNo: sessionStorage.organizationNo,
      list: list,
      farmingTypeNo: sessionStorage.farmingTypeNo
    });
  },
  /**
   * @description: 修改种养类别id查名称
   * @param {Object}  *
   */
  querybycondition(params) {
    return zhreq.post("/v3/templateTenant/plantType/queryByCondition", params);
  },
  addListES(params) {
    return zhreq.post("/v3/category/applyPlantType/add", params);
  },
  editListES(params) {
    return zhreq.post("/v3/category/applyPlantType/edit", params);
  },
  getListES(params) {
    return zhreq.post("/v3/category/applyPlantType/queryByCondition", params);
  }
};
